package birdsong.client;

import static org.junit.Assert.*;

import java.io.IOException;

import org.junit.Test;

public class CompleteTest {
	

	@Test
	public void testUser() {
		User user2 = new User("JOAO",Status.FOLLOW);
	}

	@Test
	public void testSetName() {
		User user1 = new User("JOAO",Status.FOLLOW);
		user1.setName("NICK2");
	 
	}

	@Test
	public void testGetName() {
		User user2 = new User("JOAO",Status.FOLLOW);
		assertEquals("Get the Correct Name!",user2.getName(),"JOAO");
	}

	@Test
	public void testSetEstado() {
		User user2 = new User("JOAO",Status.FOLLOW);
		user2.setEstado(Status.UNFOLLOW);	
	}

	@Test
	public void testGetEstado() {
		User user2 = new User("JOAO",Status.FOLLOW);
		assertEquals("Get the correct STATUS!",user2.getEstado(),Status.FOLLOW);
	}

	@Test
	public void testToString() {
		User user2 = new User("PETER",Status.UNFOLLOW);
		assertEquals("Get the Correct Name normal (UNFOLLOW).",user2.toString(),"PETER");
		user2.setEstado(Status.FOLLOW);
		// the -> is the mark the followed users
		assertEquals("Get the Correct Name with '->' (FOLLOW).",user2.toString(),"->PETER");
	}

	
	
	@Test
	public void testStart() {
		BirdClientComm clientComm = new BirdClientComm();
		BirdClient  client     = new BirdClient();
		client.start(clientComm);
		
	}

	@Test
	public void testBirdClient() {
		BirdClientComm clientComm = new BirdClientComm();
	}
	
	@Test
	public void testMain() {
		BirdClientMain.main(null);
	}


	BirdClientComm comm = new BirdClientComm();
	
	@Test
	public void testConnect() {
		//assertEquals("Remainder equals with Positive Value",com);
		try {
			comm.connect("localhost", "nickname");
		} catch (IOException e) {
			e.printStackTrace();
		}
		assertTrue("Not Connected", true);
		
	}

	@Test
	public void testIsConnected() {
		assertFalse("IsConnected", comm.isConnected());
	}

	@Test
	public void testDisconnect() {
		comm.disconnect();
		assertTrue("Disconnected", true);
	}

	@Test
	public void testHasNextMessage() {
		assertFalse("DOnt exist Messages", comm.hasNextMessage());
	}

	@Test
	public void testGetNextMessage() {
	
		assertEquals("There is no message! Not Connected",comm.getNextMessage(), (ClientSideMessage) null);
	}

	@Test
	public void testSendBirdsongMessage() {
		comm.sendBirdsongMessage("ola");
	}

}
